package cn.smbms.service.impl;

import cn.smbms.beans.User;
import cn.smbms.dao.UserDao;
import cn.smbms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public List<User> getUserListByAddUser(User user) {
    //    List<User> userList = userDao.getUserList(user);
      //  return userList;
        return  userDao.getUserList(user);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public void addUser(User user) {
        userDao.addUser(user);
    }
    @Transactional(propagation = Propagation.SUPPORTS)
    @Override
    public void deleteUser(User user) {
        userDao.deleteUser(user);
    }
    @Transactional(propagation = Propagation.SUPPORTS)
    @Override
    public void updateUser(User user) {
        userDao.updateUser(user);
    }


}